<%--
  Created by IntelliJ IDEA.
  User: ZhuChunXiao
  Date: 2017/5/19
  Time: 14:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<style>
  #bigTable{
    width: 60%;
    margin-left: 9%;
  }
  #bigTable td{
    text-align: center;
    height: 26px;
    line-height: 26px;
  }
  #familyMain>tr>td{
    padding: 0px;
  }
</style>
<form id="form_personnelself_input" class="panel-body form-horizontal form-padding">
  <input type="hidden" name="keyId" id="keyId" value="${personnelSelf.id}" />
  <input type="hidden" name="parentId" id="parentId" value="${personnelSelf.personnelInfo.id}" />

  <div class="form-group div-Hidden">
    <label class="col-md-2 control-label">出生日期<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <div class="input-group date">
        <input disabled type="text" class="form-control" id="birthday" name="datPlanReturn" placeholder="请选择出生日期"
               value=<fmt:formatDate pattern="yyyy-MM-dd" value="${personnelSelf.birthday}" /> >
        <span class="input-group-addon"><i class="ti-calendar"></i></span>
      </div>
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">籍贯<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input disabled type="text" id="placeOrigin" name="placeOrigin" class="form-control" placeholder="请输入籍贯" value="${personnelSelf.placeOrigin}">
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">民族<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input disabled type="text" id="nation" name="nation" class="form-control" placeholder="请输入民族" value="${personnelSelf.nation}">
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">居住地址<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input disabled type="text" id="address" name="address" class="form-control" placeholder="请输入居住地址" value="${personnelSelf.address}">
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">紧急联络人<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input disabled type="text" id="urgentPerson" name="urgentPerson" class="form-control" placeholder="请输入紧急联络人" value="${personnelSelf.urgentPerson}">
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">紧急联络电话<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input disabled type="text" id="urgentPhone" name="urgentPhone" class="form-control" placeholder="请输入紧急联络电话" value="${personnelSelf.urgentPhone}">
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">户口所在地<i class="fa fa-asterisk txt-color-red"></i>
      <span id="registeredResidenceSpan" style="display: none">${personnelSelf.registeredResidence}</span>
    </label>
    <div class="col-md-6">

      <div class="radio">
        <!-- Inline radio buttons -->
        <input disabled type="radio" name="registeredResidence" id="registeredResidence1Selected" class="magic-radio" value="1"
        <c:if test="${personnelSelf.registeredResidence eq 1}"> checked="checked"</c:if> >
        <label for="registeredResidence1Selected">上海户口</label>

        <input disabled type="radio" name="registeredResidence" id="registeredResidence2Selected" class="magic-radio" value="2"
        <c:if test="${personnelSelf.registeredResidence eq 2}"> checked="checked"</c:if> >
        <label for="registeredResidence2Selected">非上海户口</label>

      </div>
    </div>
  </div>

  <div id="showResidencePermit" class="form-group" <c:if test="${personnelSelf.id==null||personnelSelf.registeredResidence==1}">style="display: none" </c:if> >
    <label class="col-md-2 control-label">居住证登记<i class="fa fa-asterisk txt-color-red"></i>
      <span id="residencePermitSpan" style="display: none">${personnelSelf.residencePermit}</span>
    </label>
    <div class="col-md-6">

      <div class="radio">
        <!-- Inline radio buttons -->
        <input disabled type="radio" name="residencePermit" id="residencePermit1Selected" class="magic-radio" value="1"
        <c:if test="${personnelSelf.residencePermit eq 1}"> checked="checked"</c:if> >
        <label for="residencePermit1Selected">有</label>

        <input disabled type="radio" name="residencePermit" id="residencePermit2Selected" class="magic-radio" value="2"
        <c:if test="${personnelSelf.residencePermit eq 2}"> checked="checked"</c:if> >
        <label for="residencePermit2Selected">无</label>

      </div>
    </div>
  </div>

  <div id="showReDate" class="form-group div-Hidden" <c:if test="${personnelSelf.id==null||personnelSelf.residencePermit==2}">style="display: none" </c:if> >
    <label class="col-md-2 control-label">居住证开始日期<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-2">
      <div class="input-group date">
        <input disabled type="text" class="form-control" id="reDateStart" name="reDateStart" placeholder="请选择居住证开始日期"
               value=<fmt:formatDate pattern="yyyy-MM-dd" value="${personnelSelf.reDateStart}" /> >
        <span class="input-group-addon"><i class="ti-calendar"></i></span>
      </div>
    </div>
    <label class="col-md-2 control-label">居住证结束日期<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-2">
      <div class="input-group date">
        <input disabled type="text" class="form-control" id="reDateEnd" name="reDateEnd" placeholder="请选择居住证结束日期"
               value=<fmt:formatDate pattern="yyyy-MM-dd" value="${personnelSelf.reDateEnd}" /> >
        <span class="input-group-addon"><i class="ti-calendar"></i></span>
      </div>
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">婚姻状况<i class="fa fa-asterisk txt-color-red"></i>
      <span id="marrySpan" style="display: none">${personnelSelf.marry}</span>
    </label>
    <div class="col-md-6">

      <div class="radio">
        <!-- Inline radio buttons -->
        <input disabled type="radio" name="marry" id="marry1Selected" class="magic-radio" value="1"
        <c:if test="${personnelSelf.marry eq 1}"> checked="checked"</c:if> >
        <label for="marry1Selected">已婚</label>

        <input disabled type="radio" name="marry" id="marry2Selected" class="magic-radio" value="2"
        <c:if test="${personnelSelf.marry eq 2}"> checked="checked"</c:if> >
        <label for="marry2Selected">未婚</label>

      </div>
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">最高学历<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input disabled type="text" id="education" name="education" class="form-control" placeholder="请输入最高学历" value="${personnelSelf.education.name}">
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-2 control-label">毕业学校<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input disabled type="text" id="school" name="school" class="form-control" placeholder="请输入毕业学校" value="${personnelSelf.school}">
    </div>
  </div>

  <div class="form-group">
    <table class="table table-bordered" id="bigTable">
      <thead>
      <tr>
        <td colspan="7">家庭情况</td>
      </tr>
      <tr>
        <td>称谓</td>
        <td>姓名</td>
        <td>年龄</td>
        <td>政治面貌</td>
        <td>工作单位</td>
        <td>职务</td>
        <td>联系电话</td>
      </tr>
      </thead>
      <tbody id="familyMain">

      </tbody>
    </table>
  </div>


  <div class="form-group">
    <label class="col-md-2 control-label">提交人</label>
    <div class="col-md-2">
      <p class="form-control-static">${personnelSelf.creater.name}</p>
    </div>
    <label class="col-md-2 control-label">提交日期</label>
    <div class="col-md-2">
      <p class="form-control-static"><fmt:formatDate pattern="yyyy-MM-dd" value="${personnelSelf.createTime}" /></p>
    </div>
  </div>
</form>
<!--===================================================-->
<!-- END BASIC FORM ELEMENTS -->

<div class="panel-footer">
  <a class="btn btn-default" id="apply-re-common2" href="javascript:void(0)">
    <i class="fa fa-lg fa-mail-reply"></i> 返回视图
  </a>
  <c:if test="${personnelSelf.numStatus==0 && user.id==personnelSelf.creater.id}">
    <a class="btn btn-warning" key="ajax_personnelself_edit" href="javascript:void(0);"><i class="fa fa-lg fa-edit"></i> 编辑表单 </a>
  </c:if>
</div>

<script>

  $(function(){

    var famJson='${personnelSelf.family}';

    //设置family数据
    if(famJson!=null&&famJson!=""){
      var family=eval(famJson);
      for(var i=0;i<family.length;i++){
        var tr=$("<tr><td>"+family[i].familyNickName+"</td>" +
        "<td>"+family[i].familyName+"</td>" +
        "<td>"+family[i].familyAge+"</td>" +
        "<td>"+family[i].familyPolitical+"</td>" +
        "<td>"+family[i].familyWork+"</td>" +
        "<td>"+family[i].familyPost+"</td>" +
        "<td>"+family[i].familyPhone+"</td></tr>");
        $("#familyMain").append(tr);
      }
    }

  });

  //返回视图
  $("#apply-re-common2").click(returnToHashUrl);

  //编辑
  $("a[key='ajax_personnelself_edit']").unbind("click").bind("click",function(){
    __confirm_dialog("提示：","确定要编辑基本信息吗？",
            function () {
              // 加载编辑页面
              loadURL("<%=path%>/activiti/personnelself/edit/"+$("#form_personnelself_input #keyId").val()+"?parentId="+$("#form_personnelself_input #parentId").val(),$('#bsc-tab-2'));
            }
    )
  });

</script>